import http from '@/utils/http'
enum Api {
  getImg = '/api/sysUser/image',
  login = '/user/login',
  getInfo = '/api/sysUser/getInfo',
  getUserPage = '/user/page',
  userAdd = '/user/save',
  userUpdate = '/user/update',
  taskUserUpdataApi = '/task/updateUserIds',
  getExperUserInfo = '/user/getUser',
  userLogoutApi='/user/logout'
}
import { LoginResult, LoginParm, UserInfo, UserPage, UserAddModel } from './UserModel'
/**
 * 用户退出登录
 */
export const userLogoutApi = async () => {
  return http.get(Api.userLogoutApi)
}
/**
 * 用户编辑
 */
export const userUpdateApi = async (params: UserAddModel) => {
  return http.post(Api.userUpdate, params)
}
export const getExperUserInfo = async (data) => {
  return http.post(Api.getExperUserInfo, data)
}
/**
 * 用户新增
 */
export const userSaveApi = (params: UserAddModel) => {
  return http.post(Api.userAdd, params)
}
/**
 * 获取用户列表
 */
export const userPageApi = async (params: UserPage) => {
  return http.get(Api.getUserPage, params)
}
export async function getImageApi(url) {
  // 这个地方如果自己来操作 该怎么弄啊 把那边的东西弄过来就好了 试试呗
  return await http.getImage(Api.getImg, url)
}
/**
 * 登录
 */
export async function loginApi(params: LoginParm) {
  return await http.post<LoginResult>(Api.login, params)
}
/**
 * 用户信息
 */
export const getUserInfo = async () => {
  return await http.get<UserInfo>(Api.getInfo)
}
// 用户配置
export const taskUserUpdataApi = async (data) => {
  return http.post(Api.taskUserUpdataApi, data)
}

